package com.data.monitoring.model.ENUM;

/**
 * 服务器认证方式枚举
 */
public enum AuthMethod {
    /**
     * 密码认证
     */
    PASSWORD("password"),

    /**
     * 密钥认证
     */
    KEY("key");

    private final String value;

    AuthMethod(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    /**
     * 从字符串值转换为枚举
     */
    public static AuthMethod fromValue(String value) {
        for (AuthMethod method : AuthMethod.values()) {
            if (method.value.equalsIgnoreCase(value)) {
                return method;
            }
        }
        throw new IllegalArgumentException("无效的认证方式: " + value);
    }

    @Override
    public String toString() {
        return this.value;
    }
}